//
// Created by liushuai on 12/7/19.
//
#include "choosesort.h"
std::vector<int> choosesort(std::vector<int> &v) {
    int min_index = 0;
    int length = v.size();
    for (int start_index = 0; start_index < length; start_index++) {
        int min_value = v.at(start_index);
        int min_index = start_index;
        for (int i = start_index; i < length; i++) {
            if (v.at(i) < min_value) {
                min_value = v.at(i);
                min_index = i;
            }
        }
        std::swap(v.at(start_index), v.at(min_index));
    }
    return v;
}
